The code that implements the OPC server (using OPC Wizard) cannot just be written and built - it ultimately needs to be run, and for it it needs to be hosted in some kind of executable application. There are many hosting options; the OPC Wizard does no artificially limit them, but some are more common and practical than others. This article will specifically address certain typical hosting scenarios. However, other hosting options exist as well.
In all cases, your code needs to create an instance of the EasyUAServer Class and define its properties and populate the node space. It then needs to call the Start Method on the server object. When this happens depends on the hosting scenario. The OPC server is started, and it keeps running. At some later moment, when the server needs to be shut down, your code should call the Stop Method. The host may require additional code in order to integrate it with your server.
Hosting the OPC Server in a console application is probably the easiest option in terms of coding effort needed to implement it; and the same time, it is also very easy to debug. There is almost no extra code necessary to make the server work inside the console application.
The following example illustrates a fully functional OPC Wizard-based server, hosted in a console application. The server also outputs information related to the state of its endpoints, and client connections and disconnections.
OPC servers developed with OPC Wizard can be hosted inside a Windows desktop application developed using Windows Forms (and in fact, the application can also be developed using WPF or other tools). This hosting option provides a possibility of integrating the OPC server with rich user interface, inside the same process.
One advantage of hosting the OPC server in Windows Forms application is that it can be easily integrated with the Administer OPC UA Application Dialog.
Example: Installed Examples - Server Windows Forms - UAServerWindowsFormsDemo
Hosting your OPC server in a Windows service is meant mainly for "head-less", fully automated operations. The service has several advantages over other hosting options, The service can be started and stopped in various ways provided by the operating system, and it can even start together with the operating system. The service can operate without any interactive user being logged in, and it can be configured to run under a specific user account. See e.g. the ServiceBase Class documentation for more information on developing Windows Services in this way.
Example: Installed Examples - Server Windows Service - UAServerWindowsServiceDemo
The "worker service" (Worker services in .NET) is a basically a modern way of creating a service-like application in .NET - not just Windows service, but eventually also a Linux daemon, etc.
The following example illustrates how an OPC server hosted in a worker service can be created.